import numpy as np
from PIL import Image
import joblib

# 加载模型
model = joblib.load('captcha_model.pkl')

# 加载验证码图片
image = Image.open('captcha.png').convert('L')
image = image.resize((160, 60))
image = np.array(image).flatten()

# 预测验证码
predicted_captcha = model.predict([image])[0]
print('Predicted captcha:', predicted_captcha)